package operation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

public class Find implements IOperation{
    @Override
    public void work (BookList bookList) {
        System.out.println ("查找图书");
        System.out.println ("输入要查询的书名");
        Scanner p=new Scanner (System.in);
        String name=p.nextLine ();
        int current=bookList.getUsedSize ();
        for (int i = 0; i < current; i++) {
            Book b=bookList.getBooks (i);
            if(b.getName ().equals (name)){
                System.out.println ("找到您要查询的书");
                System.out.println (b);
                return;
            }
        }

        System.out.println ("没有您要找的书");

    }
}
